var subWin = null;
var subWinList = new Array();

function showWin(){
	 if (!document.getElementsByTagName) return false;
	 var links = document.getElementsByTagName("a");
	 for ( var i=0; i < links.length; i++) {
		 links[i].onclick =  function(){
			if(this.getAttribute('target')=='_blank' ) {
			  subWin = window.open(this.getAttribute('href'));
			  subWinList.push(subWin);
			  return false;
			}
		}
	 }
}
function openwindow(url,name,iWidth,iHeight)
{
    var url;
    var name;
    var iWidth;
    var iHeight;
    var iTop = (window.screen.availHeight-30-iHeight)/2;
    var iLeft = (window.screen.availWidth-10-iWidth)/2;
    subWin=window.open(url,name,'height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,directoried=no,menubar=no');
	subWinList.push(subWin);
}
function closeChild(){
	if (subWin && subWin.open && !subWin.closed){
		subWin.close();
	}
	for(i=0;i<subWinList.length;i++){
		subWinList[i].close();
	}
}
showWin();
window.attachEvent("onload",showWin);
window.onunload=closeChild;